<?php
/*
 * @Descripttion: 
 * @version: 1.0
 * @Author: Sam
 * @Date: 2022-04-21 15:27:09
 * @LastEditors: Sam
 * @LastEditTime: 2022-04-26 19:30:25
 */
use think\facade\Db;
use app\admin\model\AuthRule as AuthRuleModel;

if (!AuthRuleModel::where('title', '轮播图管理')->count()) {

    $parent_id = AuthRuleModel::query()->create([
        'parent_id'    => 0,
        'title'        => '轮播图管理',
        'url'          => '#',
        'method'       => 'OPTIONS',
        'slug'         => 'banner'
    ]);
     AuthRuleModel::query()->create([
        'parent_id'    => $parent_id->id,
        'title'        => '轮播图列表',
        'url'          => 'banner_index',
        'method'       => 'GET',
        'slug'         => 'banner.index'
    ]);
    AuthRuleModel::query()->create([
        'parent_id'    => $parent_id->id,
        'title'        => '添加轮播图',
        'url'          => 'banner_create',
        'method'       => 'POST',
        'slug'         => 'banner.create'
    ]);
    AuthRuleModel::query()->create([
        'parent_id'    => $parent_id->id,
        'title'        => '编辑轮播图',
        'url'          => 'banner_edit',
        'method'       => 'POST',
        'slug'         => 'banner.edit'
    ]);
    AuthRuleModel::query()->create([
        'parent_id'    => $parent_id->id,
        'title'        => '删除轮播图',
        'url'          => 'banner_delete',
        'method'       => 'POST',
        'slug'         => 'banner.delete'
    ]);
}










